/*
 * Improbability Drive
 * Phillip Cardon, Thach Nguyen, Cristopher Claeys
 * 4/26/2011
 */

package structures;

import java.net.URL;

/**
 * The data structure for communication between the DataGatherer and the PageParser
 * 
 * @author Cristopher Claeys
 */
public class GathererStruct {
	
	/**
	 * The word count from the parsed page.
	 */
	//private int words;
	
	/**
	 * The time spent parsing a page.
	 */
	private long parseTime;
	
	/**
	 * The link count from the parsed page.
	 */
	private int links;
	
	/**
	 * The URL of the page parsed.
	 */
	private URL latest;
	
	/**
	 * The parsed String.
	 */
	private String parsed;
	
	/**
	 * Constructs a new GathererStruct with the given values, these may be 0/null since there are set methods.
	 * 
	 * @param word_count The word count.
	 * @param link_count The link count.
	 * @param latest_page The page URL.
	 * @param parsed_page The parsed string.
	 */
	public GathererStruct(final int link_count, final URL latest_page, final String parsed_page,
						  final long parse_time) {
		//words = word_count;
		links = link_count;
		latest = latest_page;
		parsed = parsed_page;
		parseTime = parse_time;
	}
	
	/**
	 * Sets the word count.
	 * 
	 * @param word_count The word count.
	 */
	/*public void setWords(int word_count) {
		words = word_count;
	}*/
	
	/**
	 * Sets the link count.
	 * 
	 * @param link_count The link count.
	 */
	public void setLinks(final int link_count) {
		links = link_count;
	}
	
	/**
	 * Sets the page URL.
	 * 
	 * @param latest_page The page URL.
	 */
	public void setLatest(final URL latest_page) {
		latest = latest_page;
	}
	
	/**
	 * Sets the parsed String.
	 * 
	 * @param parsed_page The parsed page.
	 */
	public void setParsed(final String parsed_page) {
		parsed = parsed_page;
	}
	
	/**
	 * Sets the parse time of the page.
	 * 
	 * @param parse_time The parse time.
	 */
	public void setParseTime(final long parse_time)
	{
		parseTime = parse_time;
	}
	
	/**
	 * Gets the word count.
	 * 
	 * @return the word count.
	 */
	/*public int getWords() {
		return words;
	}*/
	
	/**
	 * Gets the link count.
	 * 
	 * @return the link count.
	 */
	public int getLinks() {
		return links;
	}
	
	/**
	 * Gets the URL of the page.
	 * 
	 * @return the URL of the page.
	 */
	public URL getLatest() {
		return latest;
	}
	
	/**
	 * Gets the parsed String.
	 * 
	 * @return the parsed String.
	 */
	public String getParsed() {
		return parsed;
	}
	
	/**
	 * @return What is the parse time?
	 */
	public long getParseTime()
	{
		return parseTime;
	}
	
	public String toString() {
		return (links + latest.toString() + parsed);
	}
}
